package 贪心;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Antique {
	public static void main(String[] args) {
		
	}
	
	public static void selectAntique() {
		int[] antiques = new int[]{3, 5, 4, 10, 7, 14, 2, 11};
		int capacity = 30;
		Arrays.sort(antiques);
		int newCapacity = 0;
		List<Integer> selectedAntiques = new ArrayList<>();
		for (int i = 0; i < antiques.length && (newCapacity += antiques[i]) <= capacity; i++) {
			selectedAntiques.add(antiques[i]);
		}
		System.out.println(selectedAntiques);
	}
}
